#!/bin/bash
yum install -y gcc make pcre-devel zlib-devel wget tar
wget http://nginx.org/download/nginx-1.26.3.tar.gz
tar -zxvf nginx-1.26.3.tar.gz
cd nginx-1.26.3
./configure --prefix=/usr/local/nginx 
make && make install
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
# 临时export增加环境变量
export PATH=/usr/local/nginx/sbin:$PATH
# 永久增加环境变量
echo 'export PATH=/usr/local/nginx/sbin:$PATH' >> /etc/profile
source /etc/profile
nginx -v
# 启动
nginx 
